import java.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
//import javax.microedition.io.file.*;
//import javax.microedition.io.file.FileConnection;
//import javax.microedition.io.file.IllegalModeException;
import javax.microedition.lcdui.game.Sprite;
import java.util.*;






public class ScrollCanvas extends Canvas {
	//private ImageViewer midlet;
	private Image im;
	private Image imoriginal;
	private int x, y,w,h,yenemy;
	//FileConnection fconn;
	private int zoomlevel;
	private boolean rotate=false;
        int numero,maximo;
	Random number;
        int width;
        int height;

  public ScrollCanvas(){
	//this.midlet = mid;
	//final String filen=filename;
	setFullScreenMode(true);

	width = getWidth();
	height = getHeight();
	maximo=68;
	x = 0;
	y = 0;

        try {
		
		imoriginal=Image.createImage("/fondosmall.png");
	
        } catch (OutOfMemoryError e) {
            throw e;
        } catch (Exception e) {
            System.out.println(e);
            e.printStackTrace();
        }


	//w=im.getWidth();
	//h=im.getHeight();
	number = new Random();
	number.setSeed(System.currentTimeMillis());
	//numero = number.nextInt();

  }
  public void paint(Graphics g) {
	String zm="";
	g.setColor(110,168,234);
	g.fillRect(0,0,getWidth(),getHeight());
	g.setColor(0,0,0);
	g.drawImage(imoriginal,width/2,0,Graphics.TOP|Graphics.HCENTER);
	//yenemy=yenemy+1;
	//g.drawImage(im,x,y,Graphics.TOP|Graphics.LEFT);
	//g.drawString("0",x,200,Graphics.TOP|Graphics.LEFT);
        g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM));
	g.drawString("www.arcadenea.com.ar",width/2,height/2,Graphics.TOP|Graphics.HCENTER);
//	g.drawString("Generador de numeros",width/2,height/2+(height/8),Graphics.TOP|Graphics.HCENTER);
//	g.drawString("pseudoaleatorios",width/2,height/2+(height/6),Graphics.TOP|Graphics.HCENTER);
	g.drawString(Integer.toString(numero),width/2,height/2+(height/4),Graphics.TOP|Graphics.HCENTER);

	
    }

 
	
	protected void keyPressed(int keyCode) {
	switch(getGameAction(keyCode)){
			case Canvas.FIRE:{ 
				 // Random number = new Random();
				  numero = number.nextInt(maximo)+2;
				  //number.setSeed(System.currentTimeMillis());
                        break;}
	}
      //this.repaint();
	}

	protected void keyRepeated(int keyCode) {
	switch(getGameAction(keyCode)){
			case Canvas.FIRE:{ 
				 // Random number = new Random();
				  numero = number.nextInt(maximo)+2;
				  //number.setSeed(System.currentTimeMillis());
                        break;}
	}
      //this.repaint();
	}

	protected void keyReleased(int keyCode) {
	
      this.repaint();
	}




    
	
	
}
